/**
 * 
 */
package com.thor.palmmall.rest.vkcommunicate.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.util.ConverterUtil;
import com.thor.palmmall.rest.vkcommunicate.AVKCommunicate;
import com.thor.palmmall.spi.vkcommunicate.SVKCommunicate;

/**
 * @author Captain
 *
 * @since 1.0
 */
public class AVKCommunicateConverter implements Converter<SVKCommunicate, AVKCommunicate> {

  public static AVKCommunicateConverter getInstance() {
    if (instance == null)
      instance = new AVKCommunicateConverter();
    return instance;
  }

  private static AVKCommunicateConverter instance;

  private AVKCommunicateConverter() {
  }

  @Override
  public AVKCommunicate convert(SVKCommunicate source) {
    if (source == null) {
      return null;
    }
    AVKCommunicate target = new AVKCommunicate();

    target.setUuid(source.getUuid());
    target.setVersion(source.getVersion());
    target.setVersionTime(source.getVersionTime());
    target.setProject(source.getProject());
    target.setCustomerSource(source.getCustomerSource());
    target.setShopNumber(source.getShopNumber());
    target.setBrandName(source.getBrandName());
    target.setCategoryName(source.getCategoryName());
    target.setTenantName(source.getTenantName());
    target.setDiscussModeAndAddress(source.getDiscussModeAndAddress());
    target.setTenanter(source.getTenanter());
    target.setTenantView(source.getTenantView());
    target.setInvestActor(source.getInvestActor());
    target.setContact(source.getContact());
    target.setArea(source.getArea());
    target.setCanEditView(source.getCanEditView());
    target.setDiscussTheme(source.getDiscussTheme());
    target.setDetails(
        ConverterUtil.convert(source.getDetails(), AVKCommunicateDetailConverter.getInstance()));

    return target;
  }

}
